/**
 *  Copyright (c)  2011-2020 Panguso, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Panguso, 
 *  Inc. ("Confidential Information"). You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into with Panguso.
 */

/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.clean;

import cn.edu.thu.log.read.LogBufferModified;
import cn.edu.thu.log.tree.CalculateTree;
import cn.edu.thu.log.tree.ManyTree;
import cn.edu.thu.log.web.service.LogCleanConfigReadService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

/**
 * 
 * @author wan
 */
public class NoiseIdentify1 {

	private ManyTree manyTree;
	private String min;
	private String max;
	// private int flag=1;//默认符合格式要求
	private ArrayList<String> headtagList;
	private Map<String, String> bodytagMap;
	private CalculateTree calculate;
	private String classifyTags;
	// private ArrayList<String> classifyArrayList;
	// private LogBuffer record;
	// private CalculateTree calculate;
	// time
	private long timeCalculatetree = 0;
	
	public long getTimeCalculatetree() {
		return timeCalculatetree;
	}
	
	public void setTimeCalculatetree(long newtimeCalculatetree) {
		this.timeCalculatetree = newtimeCalculatetree;
	}
	
	
/**
 * 
 * @param readLogCleanConfigService parameter
 */
	public void readNoiseIdetifyConfigFile(
			LogCleanConfigReadService readLogCleanConfigService) {
		System.out
				.println("begin Read NoiseIdentifyConfigFile and build tree!");
		readLogCleanConfigService.readNoiseConfig();
		manyTree = readLogCleanConfigService.getManyTree();
		// min = readLogCleanConfigService.getMin();
		// max = readLogCleanConfigService.getMax();
		classifyTags = readLogCleanConfigService.getClassifyTags();
		calculate = new CalculateTree(classifyTags);
	}
/**
 * 
 * @param record parameter
 * @return
 * @throws IOException 异常处理
 */
	public boolean logNoise(LogBufferModified record) throws IOException {

		boolean result = calculate.calculateTree(manyTree.getRoot(), record);

		return result;
	}
}
